package com.ruoyi.bookSys.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bookSys.mapper.BookBorrowMapper;
import com.ruoyi.bookSys.domain.BookBorrow;
import com.ruoyi.bookSys.service.IBookBorrowService;

/**
 * 图书借阅记录Service业务层处理
 * 
 * @author liugang
 * @date 2025-10-14
 */
@Service
public class BookBorrowServiceImpl implements IBookBorrowService 
{
    @Autowired
    private BookBorrowMapper bookBorrowMapper;

    /**
     * 查询图书借阅记录
     * 
     * @param borrowId 图书借阅记录主键
     * @return 图书借阅记录
     */
    @Override
    public BookBorrow selectBookBorrowByBorrowId(Long borrowId)
    {
        return bookBorrowMapper.selectBookBorrowByBorrowId(borrowId);
    }

    /**
     * 查询图书借阅记录列表
     * 
     * @param bookBorrow 图书借阅记录
     * @return 图书借阅记录
     */
    @Override
    public List<BookBorrow> selectBookBorrowList(BookBorrow bookBorrow)
    {
        return bookBorrowMapper.selectBookBorrowList(bookBorrow);
    }

    /**
     * 新增图书借阅记录
     * 
     * @param bookBorrow 图书借阅记录
     * @return 结果
     */
    @Override
    public int insertBookBorrow(BookBorrow bookBorrow)
    {
        bookBorrow.setCreateTime(DateUtils.getNowDate());
        return bookBorrowMapper.insertBookBorrow(bookBorrow);
    }

    /**
     * 修改图书借阅记录
     * 
     * @param bookBorrow 图书借阅记录
     * @return 结果
     */
    @Override
    public int updateBookBorrow(BookBorrow bookBorrow)
    {
        bookBorrow.setUpdateTime(DateUtils.getNowDate());
        return bookBorrowMapper.updateBookBorrow(bookBorrow);
    }

    /**
     * 批量删除图书借阅记录
     * 
     * @param borrowIds 需要删除的图书借阅记录主键
     * @return 结果
     */
    @Override
    public int deleteBookBorrowByBorrowIds(Long[] borrowIds)
    {
        return bookBorrowMapper.deleteBookBorrowByBorrowIds(borrowIds);
    }

    /**
     * 删除图书借阅记录信息
     * 
     * @param borrowId 图书借阅记录主键
     * @return 结果
     */
    @Override
    public int deleteBookBorrowByBorrowId(Long borrowId)
    {
        return bookBorrowMapper.deleteBookBorrowByBorrowId(borrowId);
    }
}
